package com.zjf.carpark.service.impl;

import com.zjf.carpark.dao.TAdviseDao;
import com.zjf.carpark.entities.TAdvise;
import com.zjf.carpark.service.TAdviseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (TAdvise)表服务实现类
 *
 * @author makejava
 * @since 2020-05-12 11:26:47
 */
@Service("tAdviseService")
public class TAdviseServiceImpl implements TAdviseService {
    @Resource
    private TAdviseDao tAdviseDao;

    /**
     * 通过ID查询单条数据
     *
     * @param adviseid 主键
     * @return 实例对象
     */
    @Override
    public TAdvise queryById(Integer adviseid) {
        return this.tAdviseDao.queryById(adviseid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<TAdvise> queryAllByLimit(int offset, int limit) {
        return this.tAdviseDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param tAdvise 实例对象
     * @return 实例对象
     */
    @Override
    public TAdvise insert(TAdvise tAdvise) {
        this.tAdviseDao.insert(tAdvise);
        return tAdvise;
    }

    /**
     * 修改数据
     *
     * @param tAdvise 实例对象
     * @return 实例对象
     */
    @Override
    public TAdvise update(TAdvise tAdvise) {
        this.tAdviseDao.update(tAdvise);
        return this.queryById(tAdvise.getAdviseid());
    }

    /**
     * 通过主键删除数据
     *
     * @param adviseid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer adviseid) {
        return this.tAdviseDao.deleteById(adviseid) > 0;
    }
}